import { lib, game, ui, get, ai, _status } from "../../../noname.js";
export default {
    name: "DALF_standard",
    character: {
        "DALF_TobiichiOrigami": ["female", "DALF_group", 3, ["DALF_tianyi", "DALF_shengmian", "DALF_rilun", "DALF_paoguan"],
            ["name:鸢一|折纸"]
        ],
        "DALF_HonjouNia": ["female", "DALF_group", 3, ["DALF_niegao", "DALF_xiaolan"],
            ["name:本条|二亚"]
        ],
        "DALF_TokisakiKurumi": ["female", "DALF_group", 3, ["DALF_shicheng", "DALF_sizhou"],
            ["name:时崎|狂三"]
        ],
        "DALF_HimekawaYoshino": ["female", "DALF_group", "3/3/1", ["DALF_dongjie", "DALF_xueyin", "DALF_hanqiao"],
            ["name:氷芽川|四糸乃"]
        ],
        "DALF_ItsukaKotori": ["female", "DALF_group", 3, ["DALF_chongran", "DALF_yanxi", "DALF_chizhuo"],
            ["name:五河|琴里"]
        ],
        "DALF_HoshimiyaMukuro": ["female", "DALF_group", 4, ["DALF_Seguva", "DALF_Shifururu", "DALF_Rataibu", "DALF_Heresu"],
            ["name:星宫|六喰"]
        ],
        "DALF_KyonoNatsumi": ["female", "DALF_group", 3, ["DALF_yanzuo", "DALF_jingxiang"],
            ["name:镜野|七罪"]
        ],
        "DALF_YamaiYuzuru": ["female", "DALF_group", 4, ["DALF_jufeng", "DALF_jichi", "dualside"],
            ["dualside:DALF_YamaiKguya", "name:八舞|耶俱矢"]
        ],
        "DALF_YamaiKguya": ["female", "DALF_group", 4, ["DALF_xieliao", "DALF_tianji", "dualside"],
            ["forbidai", "unseen", "name:八舞|夕弦"]
        ],
        "DALF_IzayoiMiku": ["female", "DALF_group", 3, ["DALF_hexian", "DALF_xiezou", "DALF_shengmu"],
            ["name:诱宵|美九"]
        ],
        "DALF_YatogamiTohka": ["female", "DALF_group", 4, ["DALF_zhongjian", "DALF_aosha"],
            ["name:夜刀神|十香"]
        ]
    },
    characterTitle: {
        "DALF_TobiichiOrigami": "<font color=#FAFA64>绝灭天使</font>",
        "DALF_HonjouNia": "<font color=#F0FFFF>嗫告篇帙</font>",
        "DALF_TokisakiKurumi": "<font color=#AA3300>刻刻帝</font>",
        "DALF_HimekawaYoshino": "<font color=#91D0F6>冰结傀儡</font>",
        "DALF_ItsukaKotori": "<font color=#FF4800>灼烂歼鬼</font>",
        "DALF_HoshimiyaMukuro": "<font color=#FFDE32>封解主</font>",
        "DALF_KyonoNatsumi": "<font color=#60DE79>赝作魔女</font>",
        "DALF_YamaiYuzuru": "<font color=#8272FF>飓风骑士</font>",
        "DALF_YamaiKguya": "<font color=#8272FF>飓风骑士</font>",
        "DALF_IzayoiMiku": "<font color=#DD64EC>破军歌姬</font>",
        "DALF_YatogamiTohka": "<font color=#EEB2FF>鏖杀公</font>"
    },
    translate: {
        "DALF_standard": "十质点",


        "DALF_TobiichiOrigami": "鸢一折纸",
        "DALF_tianyi": "天翼",
        "DALF_tianyi_info": "你使用牌指定其他角色为目标后，你可以令任意个目标无效，这些角色各弃置一张牌。",
        "DALF_shengmian": "圣冕",
        "DALF_shengmian_info": "锁定技，其他角色失去最后的手牌时，你摸一张牌。",
        "DALF_rilun": "日轮",
        "DALF_rilun_info": "准备阶段，你可以视为使用【万箭齐发】。",
        "DALF_paoguan": "炮冠",
        "DALF_paoguan_info": "限定技，出牌阶段，你可以弃置至少一张花色不同的手牌，对攻击范围内的一名角色造成等量伤害。其他角色各可弃置两张牌令伤害值-1。",


        "DALF_HonjouNia": "本条二亚",
        "DALF_niegao": "嗫告",
        "DALF_niegao_info": "当一名角色每回合第一次使用牌A时，若牌A为主动即时牌，你可以明置一张主动牌B，令其为牌A按牌B主动使用的方式重新指定目标。",
        "DALF_xiaolan": "晓览",
        "DALF_xiaolan_info": "锁定技，你跳过摸牌阶段并观看牌堆（无序），从其中获得一至两张牌。你以此法获得的牌不计入手牌上限。",
        "DALF_xiaolan_backup": "晓览",


        "DALF_TokisakiKurumi": "时崎狂三",
        "DALF_shicheng": "时城",
        "DALF_shicheng_info": "锁定技，你攻击范围内的角色受到1点伤害后，你获得1枚“时间”标记。当你造成伤害后，受伤角色视为在你的攻击范围内。",
        "DALF_sizhou": "司宙",
        "DALF_sizhou_info": "出牌阶段，你可以移去X枚“时间”（X为本阶段该技能已发动过的次数）并选择一项：1.判定并获得黑色判定牌，将判定点数对应的时弹加入【刻刻帝】中；2.执行【刻刻帝】中一个已有的时弹效果。",
        "DALF_Zafkiel": "刻刻帝",
        "DALF_Zafkiel_info": "至多保存三种时弹，超过三种时，须移去一种时弹。",
        "DALF_Zafkiel_I": "一之弹",
        "DALF_Zafkiel_I_info": "本回合内，你使用的牌不能被响应。",
        "DALF_Zafkiel_II": "二之弹",
        "DALF_Zafkiel_II_info": "令一名角色下个回合的弃牌阶段提前两个阶段。",
        "DALF_Zafkiel_III": "三之弹",
        "DALF_Zafkiel_III_info": "令一名角色下个回合的摸牌阶段延后一个阶段。",
        "DALF_Zafkiel_IV": "四之弹",
        "DALF_Zafkiel_IV_info": "令一名其他角色进入【调虎离山】效果，直到其下个回合开始。",
        "DALF_Zafkiel_V": "五之弹",
        "DALF_Zafkiel_V_info": "卜算Y（Y为“时间”标记数）。",
        "DALF_Zafkiel_VI": "六之弹",
        "DALF_Zafkiel_VI_info": "令一名角色获得技能〖涅槃〗，其弃置三张手牌。",
        "DALF_Zafkiel_VII": "七之弹",
        "DALF_Zafkiel_VII_info": "令一名角色获得技能〖止息〗，直到其下个回合结束。",
        "DALF_Zafkiel_VIII": "八之弹",
        "DALF_Zafkiel_VIII_info": "获得一个「影子」；回合开始时，每有一个「影子」，使你进行一个出牌阶段；当你受到伤害时，移去一个「影子」防止此伤害。",
        "DALF_Zafkiel_IX": "九之弹",
        "DALF_Zafkiel_IX_info": "令一名角色获得起始手牌，将手牌弃置至四张。",
        "DALF_Zafkiel_X": "十之弹",
        "DALF_Zafkiel_X_info": "本回合内，其他角色的手牌对你可见。",
        "DALF_Zafkiel_XI": "十一弹",
        "DALF_Zafkiel_XI_info": "标记一名角色的手牌数；若其已被标记，则先清除此标记，且在此之后令其将体力与手牌调整至该标记记录。",
        "DALF_Zafkiel_XII": "十二弹",
        "DALF_Zafkiel_XII_info": "标记一名角色的体力值；若其已被标记，则先清除此标记，且在此之后令其将体力与手牌调整至该标记记录。",
        "DALF_Zafkiel_XIII": "十三弹",
        "DALF_Zafkiel_XIII_info": "移去此时弹，选择一种时弹加入【刻刻帝】。",


        "DALF_HimekawaYoshino": "氷芽川四糸乃",
        "DALF_HimekawaYoshino_ab": "四糸乃",
        "DALF_dongjie": "冻结",
        "DALF_dongjie_info": "当一名角色的装备区或判定区失去所有牌时，你可以摸两张牌，将两张手牌随机置入该角色的场上区域（优先置入判定区和空置装备栏）。以此法置入判定区的牌视为【冻雨】。",
        "DALF_xueyin": "雪吟",
        "DALF_xueyin_info": "当你受到伤害后，你可以弃置一张手牌，弃置场上所有与此牌花色相同的牌（若你弃置的不是装备牌，你不能以此法弃置场上的装备牌）。每弃置两张牌，你摸两张牌；每弃置三张牌，你获得1点护甲。",
        "DALF_hanqiao": "寒峭",
        "DALF_hanqiao_info": "当你弃置一名角色的牌后，若其中有♦牌，你可以对其造成1点冰冻伤害。",


        "DALF_ItsukaKotori": "五河琴里",
        "DALF_chongran": "重燃",
        "DALF_chongran_info": "锁定技，当你不因使用或打出而失去暗置牌后，从弃牌堆中获得并明置之。当你受到伤害后，你摸一张牌并明置之。",
        "DALF_yanxi": "炎息",
        "DALF_yanxi_info": "你可以将两张明置牌当【酒】使用并摸一张牌。【酒】的伤害加成对你的伤害类锦囊牌同样生效。",
        "DALF_chizhuo": "炽灼",
        "DALF_chizhuo_info": "你可以将一张基本牌当【火攻】使用。当目标角色因此【火攻】展示牌时，你弃置之。",


        "DALF_HoshimiyaMukuro": "星宫六喰",
        "DALF_Seguva_mark": "锁",
        "DALF_Rataibu_mark": "钥",
        "DALF_Seguva": "闭",
        "DALF_Seguva_info": "出牌阶段，你可以弃置X+2张牌（X为本阶段该技能发动次数）令一名没有“锁”标记或体力上限大于1的其他角色减1点体力上限获得一枚“锁”。<br>有“锁”标记的角色：①结束阶段，若其体力上限大于1，其减1点体力上限获得一枚“锁”；②其每移去一枚“锁”加1点体力上限并回复1点体力。",
        "DALF_Shifururu": "解",
        "DALF_Shifururu_info": "①当你受到伤害时，你可以移去其他角色一枚“锁”令其摸一张牌，将此伤害转移给其；②有“锁”的角色摸牌阶段或弃牌阶段开始前，你可以移去其两枚“锁”令其跳过之。",
        "DALF_Rataibu": "开",
        "DALF_Rataibu_info": "锁定技，游戏开始时，你获得“钥”标记。结束阶段，你移动或收回“钥”标记。<br>有“钥”标记的角色：①手牌上限-2，摸牌阶段多摸两张牌；②对有“锁”的角色造成伤害后，移去对方一枚“锁”令自己加1点体力上限。",
        "DALF_Heresu": "放",
        "DALF_Heresu_info": "限定技，同时持有“钥”和“锁”的角色出牌阶段开始时，你可以令其移去所有“锁”标记并摸等量的牌、每移去一枚标记本阶段可多使用一张【杀】；若其本阶段没有杀死过角色，本阶段结束时其移去“钥”标记。",


        "DALF_KyonoNatsumi": "镜野七罪",
        "DALF_yanzuo": "赝作",
        "DALF_yanzuo_info": "出牌阶段限一次，你可以弃置一张手牌，获得其他角色的一个描述中没有“锁定技”的技能。你受到伤害后，若你的技能数大于体力上限，你须失去一个技能。",
        "DALF_jingxiang": "镜像",
        "DALF_jingxiang_info": "锁定技，每回合限七次：①其他角色使用非转化实体牌响应你使用的牌、或对你结算后，你获得此牌的复制，标记为「镜像」且不计入手牌上限；②当你失去「镜像」时，若因使用或打出而失去，你弃置一张手牌；否则你本回合视为未使用过牌。",


        "DALF_YamaiYuzuru": "八舞耶俱矢",
        "DALF_jufeng": "飓风",
        "DALF_jufeng_info": "你使用【杀】指定一个目标后，你可以令其横置并重铸一个你指定区域的所有牌，其本回合不能使用或打出因此失去的花色手牌。",
        "DALF_jichi": "疾驰",
        "DALF_jichi_info": "锁定技，你使用牌无距离次数限制；每回合累计有八张牌进入弃牌堆后，你翻面并结束当前阶段与回合（不终止当前其余结算）。",
        'DALF_jichi_append': '&emsp;&ensp;<span style="font-family:yuanli">背面武将：八舞夕弦' +
            '<br>&emsp;&emsp;&emsp;&ensp;体力：4/4</span>',

        "DALF_YamaiKguya": "八舞夕弦",
        "DALF_xieliao": "解镣",
        "DALF_xieliao_info": "当你需要使用【闪】或【无懈可击】响应其他角色时，你可以重置该角色，视为使用之。",
        "DALF_tianji": "天际",
        "DALF_tianji_info": "锁定技，当你使用或打出牌响应其他角色后，你摸三张牌，清除本回合所有“牌移动”的历史记录，最后你翻面。",
        'DALF_tianji_append': '&emsp;<span style="font-family:yuanli">背面武将：八舞耶俱矢' +
            '<br>&emsp;&emsp;&emsp;体力：4/4</span>',


        "DALF_IzayoiMiku": "诱宵美九",
        "DALF_hexian": "和弦",
        "DALF_hexian_info": "每张牌限一次，你使用牌结算完后，手牌数等于你的其他角色可以“响应此牌”的形式使用一张同类型牌。",
        "DALF_xiezou": "协奏",
        "DALF_xiezou_info": "锁定技，当一张牌响应另一张牌时，若其中有你使用或打出的牌，则点数更大的一方摸一张牌。",
        "DALF_shengmu": "盛幕",
        "DALF_shengmu_info": "觉醒技，结束阶段开始时，若本回合有不少于9种点数的牌进入弃牌堆，则你获得技能〖安可〗并加1点体力上限。",
        "DALF_anke": "安可",
        "DALF_anke_info": "每回合结束阶段，你可以选择本回合使用牌响应过你的一名女性角色，你与其各回复1点体力，各获得一个仅有出牌阶段的回合。",


        "DALF_YatogamiTohka": "夜刀神十香",
        "DALF_zhongjian": "终剑",
        "DALF_zhongjian_info": "你可以将所有明置牌或所有暗置牌当【杀】使用。若目标角色体力值〔或/加〕区域内的牌数小于此【杀】对应的实体牌数，则此【杀】对其造成的伤害值〔+1/+2〕。",
        "DALF_aosha": "鏖杀",
        "DALF_aosha_info": "结束阶段，你可以摸X+1张牌并明置之，若X大于0，你可以使用一张【杀】。（X为本局内你已杀死的角色数）",


        //通用标识
        "visible_DALF": "明置牌",

    },
    dynamicTranslate: {
        DALF_Zafkiel_II(player) {
            return lib.translate['DALF_Zafkiel_II_info'].replace('令一名角色', '你的');
        },
        DALF_Zafkiel_III(player) {
            return lib.translate['DALF_Zafkiel_III_info'].replace('令一名角色', '你的');
        },
        DALF_Zafkiel_VIII(player) {
            const str = lib.translate['DALF_Zafkiel_VIII_info'];
            return str.slice(str.indexOf('；') + 1);
        },
    },
    /** @type { importCharacterConfig['skill'] } */
    skill: {
        /*鸢一折纸*/
        "DALF_tianyi": {
            audio: "ext:约会大作战/audio:1",
            trigger: {
                player: "useCardToPlayered"
            },
            direct: true,
            filter(event, player) {
                if (!event.isFirstTarget) return false;
                for (let i of event.targets) {
                    if (i == player) continue;
                    if (i.countDiscardableCards(i, 'he'))
                        return true;
                }
                return false;
            },
            async content(event, trigger, player) {
                const result = await player.chooseTarget()
                    .set('selectTarget', [1, Infinity])
                    .set('filterTarget', function (card, player, target) {
                        return _status.event.getTrigger().targets.includes(target);
                    })
                    .set('canGain', (get.tag(trigger.card, 'gain') || 0) >= 1)
                    .set('ai', function (target) {
                        var player = _status.event.player,
                            trigger = _status.event.getTrigger();
                        if (_status.event.canGain) return 0;
                        if (player.attitudeTo(target) > 0) return -get.effect(target, trigger.card, player, player);
                        if (get.effect(target, trigger.card, player, player) > 0) return 1;
                        if (trigger.card.name == 'huogong' && player.countCards('h') < 4) return 1;
                        if (trigger.excluded.includes(trigger.target)) return 1;
                        if (get.tag(trigger.card, 'respondSha') && trigger.target.mayHaveSha(player, 'respond')) return 1;
                        if (get.tag(trigger.card, 'respondShan') && trigger.target.mayHaveShan(player)) return 1;
                        return 0;
                    })
                    .set('prompt', get.prompt2('DALF_tianyi'))
                    .forResult();
                if (result.bool) {
                    let targets = result.targets.slice(0).sortBySeat();
                    player.logSkill('DALF_tianyi', targets);
                    trigger.excluded.addArray(targets);
                    for (const target of targets)
                        if (target.countDiscardableCards(target, 'he') > 0)
                            await target.chooseToDiscard('he', true)
                                .set('prompt', '天翼')
                                .set('prompt2', '弃置一张牌');
                }
            }
        },
        "DALF_shengmian": {
            audio: "ext:约会大作战/audio:2",
            trigger: {
                global: ["equipEnd", "addJudgeEnd", "gainEnd",
                    "loseAsyncEnd", "addToExpansionEnd", "loseEnd"
                ],
            },
            forced: true,
            silent: true,
            filter(event, player) {
                return game.hasPlayer(current => {
                    if (current == player) return false;
                    var evt = event.getl(current);
                    return evt && evt.hs && evt.hs.length &&
                        current.countCards('h') == 0;
                });
            },
            getIndex(event, player) {
                return game.filterPlayer(current => {
                    if (current == player) return false;
                    var evt = event.getl(current);
                    return evt && evt.hs && evt.hs.length &&
                        current.countCards('h') == 0;
                });
            },
            async content(event, trigger, player) {
                const target = event.indexedData;
                if (target.countCards('h') == 0) {
                    player.logSkill('DALF_shengmian');
                    player.line(target);
                    await player.draw();
                }
            }
        },
        "DALF_rilun": {
            audio: "ext:约会大作战/audio:2",
            trigger: {
                player: "phaseZhunbei",
            },
            frequent: "check",
            filter(event, player) {
                return player.hasUseTarget({ name: 'wanjian', isCard: true });
            },
            check(event, player) {
                return player.getUseValue({ name: 'wanjian', isCard: true }) > 0;
            },
            async content(event, trigger, player) {
                "step 0"
                player.chooseUseTarget({ name: 'wanjian', isCard: true }, true);
            }
        },
        "DALF_paoguan": {
            audio: "ext:约会大作战/audio:2",
            unique: true,
            limited: true,
            mark: true,
            intro: {
                content: "limited"
            },
            skillAnimation: true,
            animationColor: "gray",
            enable: "phaseUse",
            filter(event, player) {
                return player.countCards('h');
            },
            filterCard(card, player) {
                if (ui.selected.cards.length)
                    for (let i of ui.selected.cards)
                        if (get.suit(card) == get.suit(i))
                            return false;
                return true;
            },
            complexCard: true,
            position: "h",
            selectCard: () => [1, lib.suit.length],
            check(card) {
                return 8 - get.value(card);
            },
            filterTarget(card, player, target) {
                return player.inRange(target);
            },
            async content(event, trigger, player) {
                player.awakenSkill('DALF_paoguan');
                let damage = event.cards.length;
                let players = game.filterPlayer(function (current) {
                    return current != player;
                });
                players.sortBySeat();
                for (const current of players) {
                    const result = await current.chooseToDiscard(2, 'he')
                        .set('ai', function (card) {
                            switch (_status.event.extInfo) {
                                case 'needDiscard':
                                    return 7 - get.value(card);
                                case 'isFriend':
                                    return 4.5 - get.value(card);
                                default:
                                    return 0;
                            }
                        })
                        .set('prompt', '炮冠')
                        .set('prompt2', get.translation(event.target) + '即将受到' + get.cnNumber(damage) + '点伤害，是否弃置两张牌令伤害值-1？')
                        .set('extInfo', current.attitudeTo(event.target) <= 0 ? false : damage >= event.target.hp ? 'needDiscard' : 'isFriend');
                    if (result.bool) damage--;
                    if (damage <= 0) break;
                }
                if (damage > 0) await event.target.damage(damage);
            },
            ai: {
                order: 2,
                result: {
                    target(player, target) {
                        if (target.hp > 4) return 0;
                        if (target.hp < 2) return -3;
                        return -4.5 + target.hp;
                    },
                    player(player) {
                        var suits = [],
                            hs = player.getCards('h');
                        for (let i of hs) {
                            if (get.value(i) < 8)
                                suits.add(get.suit(i));
                            if (suits.length >= lib.suit.length)
                                break;
                        }
                        return (suits.length - lib.suit.length) * 2;
                    }
                }
            }
        },

        /*本条二亚*/
        "DALF_xiaolan": {
            audio: "ext:约会大作战/audio:2",
            init(player) {
                if (!player.storage['DALF_xiaolan_regain']) player.storage['DALF_xiaolan_regain'] = [];
            },
            trigger: {
                player: "phaseDrawBefore"
            },
            forced: true,
            async content(event, trigger, player) {
                await trigger.cancel();
                let list = [],
                    map = { basic: [], trick: [], equip: [] };
                for (let i = 0; i < ui.cardPile.childElementCount; i++) {
                    let typex = get.type2(ui.cardPile.childNodes[i]);
                    if (!map[typex]) map[typex] = [];
                    map[typex].push(ui.cardPile.childNodes[i]);
                }
            },


            enable: "phaseUse",
            usable: 1,
            chooseButton: {
                dialog(event, player) {
                    let dialog = ui.create.dialog('晓览', 'hidden');
                    let map = { basic: [], trick: [], equip: [] };
                    for (let i = 0; i < ui.cardPile.childElementCount; i++) {
                        let typex = get.type2(ui.cardPile.childNodes[i]);
                        if (!map[typex]) map[typex] = [];
                        map[typex].push(ui.cardPile.childNodes[i]);
                    }
                    for (let j in map) {
                        if (map[j].length == 0) continue;
                        dialog.addText(get.translation(j));
                        map[j].sort((a, b) => {
                            let ia = lib.inpile.indexOf(get.name(a)),
                                ib = lib.inpile.indexOf(get.name(b));
                            if (ia == -1) ia = lib.inpile.length;
                            if (ib == -1) ib = lib.inpile.length;
                            ia *= 13;
                            ib *= 13;
                            ia += (get.number(a) - 1) || 0;
                            ib += (get.number(b) - 1) || 0;
                            return ia - ib;
                        });
                        dialog.add(map[j]);
                    }
                    return dialog;
                },
                select: [1, 2],
                check(button) {
                    return (get.value(button.link) + get.useful(button.link)) *
                        (0.7 + Math.random() * 0.3);
                },
                backup(links, player) {
                    return {
                        audio: "DALF_xiaolan",
                        filterCard() { return false },
                        selectCard: -1,
                        cards: links,
                        delay: false,
                        content() {
                            "step 0"
                            let cards = lib.skill['DALF_xiaolan_backup'].cards;
                            game.log(player, '从牌堆中获得了' + get.cnNumber(cards.length) + '张牌');
                            player.gain(cards, 'draw');
                            player.storage['DALF_xiaolan_regain'].addArray(cards);
                        },
                        ai: {
                            order: 10,
                            result: {
                                player: 1
                            }
                        }
                    };
                }
            },
            ai: {
                order: 4,
                result: {
                    player: 1
                }
            },
            group: ["DALF_xiaolan_regain"],
            subSkill: {
                regain: {
                    audio: "DALF_xiaolan",
                    trigger: {
                        player: "phaseDiscardEnd"
                    },
                    forced: true,
                    filter(event, player) {
                        return player.storage['DALF_xiaolan_regain'].length > 0;
                    },
                    async content(event, trigger, player) {
                        let cards = player.storage['DALF_xiaolan_regain'].splice(0);
                        for (let i = 0; i < cards.length; i++) {
                            if (get.position(cards[i]) != 'd') cards.splice(i--, 1);
                        }
                        if (cards.length > 0) player.gain(cards, 'gain2');
                    },
                    sub: true
                }
            }
        },
        "DALF_niegao": {
            audio: "ext:约会大作战/audio:2",
            trigger: {
                global: "useCard"
            },
            direct: true,
            filter(event, player) {
                let info = get.info(event.card);
                if (!info || !info.enable) return false;
                if (event.player.getHistory('useCard').length != 1) return false;
                return get.is.instantCard(event.card) && player.hasCard(function (card) {
                    return !get.is.shownCard(card);
                }, 'h');
            },
            content() {
                "step 0"
                let next = player.chooseCard('h');
                next.set('filterCard', function (card, player) {
                    let info = get.info(card);
                    if (!info || !info.enable) return false;
                    return !get.is.shownCard(card);
                });
                let targetsValue = 0;
                for (let i of trigger.targets) {
                    targetsValue += get.effect(i, trigger.card, trigger.player, player);
                }
                next.set('valuex', targetsValue);
                next.set('attBool', player.attitudeTo(trigger.player) > 0);
                event.copyCard = new lib.element.VCard(trigger.card);
                next.set('copyCard', event.copyCard);
                next.set('ai', function (card) {
                    let trigger = _status.event.getTrigger(),
                        player = _status.event.player,
                        info = get.info(card);
                    if (info.notarget) return -_status.event.valuex;

                    _status.event.copyCard.name = get.name(card, trigger.player);
                    _status.event.copyCard.suit = get.suit(card, trigger.player);
                    _status.event.copyCard.number = get.number(card, trigger.player);
                    _status.event.copyCard.nature = get.nature(card, trigger.player);

                    let players = game.filterPlayer(),
                        valueList = [],
                        isSame = trigger.card.name == _status.event.copyCard.name;
                    for (let i = 0; i < players.length; i++) {
                        if (trigger.player.canUse(_status.event.copyCard, players[i], true, isSame === false ? null : true)) {
                            valueList.push(get.effect(players[i], trigger.card, trigger.player, player));
                        }
                    }
                    if (valueList.length == 0) return -_status.event.valuex;
                    valueList.sort((a, b) => b - a);

                    let range = get.select(get.copy(info.selectTarget));
                    game.checkMod(_status.event.copyCard, trigger.player, range, 'selectTarget', trigger.player);
                    if (range[1] <= -1) {
                        range[0] = valueList.length;
                        range[1] = valueList.length;
                    } else {
                        if (range[0] > valueList.length) {
                            range[0] = valueList.length;
                        }
                        if (range[1] > valueList.length) {
                            range[1] = valueList.length;
                        }
                    }
                    // range.sort((a, b) => b - a);

                    let values = 0;
                    for (let i = 0; i < range[1]; i++) {
                        if (i >= range[0] && (_status.event.attBool ^ valueList[i] > 0)) break;
                        values += valueList[i];
                    }

                    return values - _status.event.valuex;
                });
                next.set('prompt', get.prompt('DALF_niegao', trigger.player) + '（更改' + get.translation(trigger.card) + '的目标方法）');
                next.set('prompt2', lib.translate['DALF_niegao_info']);

                "step 1"
                if (result.bool) {
                    player.logSkill('DALF_niegao', trigger.player);

                    let card = result.cards[0];
                    player.addShownCards(card, 'visible_DALF');
                    event.copyCard.name = get.name(card, trigger.player);
                    event.copyCard.suit = get.suit(card, trigger.player);
                    event.copyCard.number = get.number(card, trigger.player);
                    event.copyCard.nature = get.nature(card, trigger.player);

                    let info = get.info(card);
                    if (info.notarget) {
                        trigger.targets = [];
                        game.log(trigger.card, '无有效目标，取消了所有目标');
                        event.finish();
                    }

                    let range = get.select(get.copy(info.selectTarget)),
                        targets = game.filterPlayer(function (current) {
                            return trigger.player.canUse(event.copyCard, current, true, (trigger.card.name == event.copyCard.name) === false ? null : true);
                        });
                    if (targets.length == 0) {
                        trigger.targets = [];
                        game.log(trigger.card, '无有效目标，取消了所有目标');
                        event.finish();
                    }
                    game.checkMod(event.copyCard, trigger.player, range, 'selectTarget', trigger.player);
                    if (range[1] <= -1) {
                        event._result = { bool: true, targets: targets };
                    } else {
                        let next = trigger.player.chooseTarget(true);
                        next.set('selectTarget', range);
                        next.set('sourceCard', trigger.card);
                        next.set('targets', targets);
                        next.set('filterTarget', function (card, player, target) {
                            return _status.event.targets.includes(target);
                        });
                        next.set('ai', function (target) {
                            return get.effect(target, _status.event.sourceCard, _status.event.player);
                        });
                        next.set('prompt', '为选择' + get.translation(trigger.card) + '重新选择目标');
                        next.set('prompt2', get.translation(player) + '明置了一张' + get.translation(card) + '，你现在需要按照' + get.translation(card) + '指定的目标规则，为' + get.translation(trigger.card) + '重新指定目标。');
                    }
                } else event.finish();

                "step 2"
                if (result.bool) {
                    trigger.targets = result.targets.slice(0);
                    game.log(trigger.card, '重指定了', trigger.targets, '为目标');
                    trigger.player.line(trigger.targets, 'orange');
                }
            }
        },

        /*时崎狂三*/
        "DALF_shicheng": {
            audio: "ext:约会大作战/audio:4",
            init(player, skill) {
                player.markSkill('DALF_shicheng');
                if (!player.storage['DALF_shicheng_extRange'])
                    player.storage['DALF_shicheng_extRange'] = [];
            },
            onremove(player) {
                player.unmarkSkill('DALF_shicheng');
            },
            marktext: "时",
            intro: {
                name: "时间",
                content: "mark",
                mark(dialog, storage, player) {
                    dialog.addText('共有' + (storage || 0) + '个标记<br>', true);
                    if (player.storage['DALF_shicheng_extRange'].length > 0) {
                        dialog.addText('以下角色视为在你的攻击范围内：', true);
                        dialog.add([player.storage['DALF_shicheng_extRange'], 'player']);
                    }
                }
            },
            mod: {
                inRange(from, to) {
                    if (from.storage['DALF_shicheng_extRange'].includes(to))
                        return true;
                }
            },
            trigger: {
                global: "damageEnd",
            },
            forced: true,
            getIndex(event, player) {
                if (player.inRange(event.player)) return event.num;
                return false;
            },
            logTarget: "player",
            async content(event, trigger, player) {
                "step 0"
                player.addMark('DALF_shicheng', 1);
            },
            group: ["DALF_shicheng_extRange"],
            subSkill: {
                extRange: {
                    audio: "DALF_shicheng",
                    trigger: { source: "damageSource" },
                    forced: true,
                    content() {
                        "step 0"
                        player.storage['DALF_shicheng_extRange'].add(trigger.player);
                    },
                    sub: true
                }
            }
        },
        "DALF_sizhou": {
            audio: "ext:约会大作战/audio:2",
            init(player, skill) {
                if (!player.storage['DALF_Zafkiel'])
                    player.storage['DALF_Zafkiel'] = [];
            },
            enable: "phaseUse",
            filter(event, player) {
                return player.getHistory(
                    'useSkill',
                    evt => evt.skill == 'DALF_sizhou'
                ).length <= player.countMark('DALF_shicheng');
            },
            chooseButton: {
                dialog(event, player) {
                    const count = player.getHistory('useSkill', evt => evt.skill == 'DALF_sizhou').length;
                    const dialog = ui.create.dialog('###司宙###' + (
                        count > 0 ? ('移去' + count + '枚“时间”标记并') : ''
                    ) + '选择一项', 'hidden');
                    dialog.add('<div class="popup text" style="width:calc(100% - 10px);display:inline-block">' +
                        '选项一：你进行判定并获得黑色判定牌，根据结果点数将对应的时弹加入【刻刻帝】中' +
                        '</div>');
                    dialog.add('<div class="popup text" style="width:calc(100% - 10px);display:inline-block">' +
                        '选项二：从【刻刻帝】中选择一个时弹的效果执行——' +
                        '</div>');
                    for (const i of player.storage['DALF_Zafkiel']) {
                        let str = lib.translate[i + '_info'];
                        if (i == 'DALF_Zafkiel_V') {
                            const num = player.countMark('DALF_shicheng') -
                                player.getHistory(
                                    'useSkill',
                                    evt => evt.skill == 'DALF_sizhou'
                                ).length;
                            str = '卜算' + num;
                        }
                        dialog.add('<div class="popup text" style="width:calc(100% - 10px);display:inline-block"><b>' +
                            lib.translate[i] + '</b>：' + str + '</div>');
                    }
                    return dialog;
                },
                chooseControl(event, player) {
                    const choices = ['选项一'];
                    for (const i of player.storage['DALF_Zafkiel'])
                        choices.push(i);
                    choices.push('cancel2');
                    return choices;
                },
                check() {
                    const player = get.player(),
                        pairsList = [
                            [0, 3.1 - player.storage['DALF_Zafkiel'].length]
                        ];
                    for (const i of player.storage['DALF_Zafkiel']) {
                        let value = lib.skill.DALF_Zafkiel.numberValue[i],
                            extvalue = 0;
                        switch (i) {
                            case 'DALF_Zafkiel_I':
                                if (player.hasSkill('DALF_Zafkiel_I'))
                                    value = 0;
                                break;
                            case 'DALF_Zafkiel_II':
                                if (!game.hasPlayer(current => {
                                    if (current.hasSkill('DALF_Zafkiel_III'))
                                        return false;
                                    if (get.attitude2(current) > 0)
                                        return current.countCards('h') <= current.getHandcardLimit();
                                    return current.countCards('h') > current.getHandcardLimit() + 2;
                                })) value = 0;
                                break;
                            case 'DALF_Zafkiel_III':
                                if (!game.hasPlayer(current => {
                                    return get.attitude2(current) < 0 &&
                                        !current.hasSkill('DALF_Zafkiel_III') &&
                                        current.countCards('h') < 2;
                                })) value = 0;
                                break;
                            case 'DALF_Zafkiel_VII':
                                game.countPlayer(current => {
                                    if (get.attitude2(current) < 0 &&
                                        !current.hasSkill('rezhixi')) {
                                        extvalue = Math.max(
                                            extvalue,
                                            current.countCards('hs') - 3
                                        );
                                    }
                                });
                                value *= extvalue;
                                break;
                            case 'DALF_Zafkiel_VIII':
                                if (player.storage['DALF_Zafkiel_VIII'] >= 3)
                                    value = 0;
                                break;
                            case 'DALF_Zafkiel_IX':
                                game.countPlayer(current => {
                                    if (get.attitude2(current) < 0) {
                                        extvalue = Math.max(
                                            extvalue,
                                            current.countCards('hs') - 4
                                        );
                                    } else {
                                        extvalue = Math.max(
                                            extvalue,
                                            4 - current.countCards('hs')
                                        );
                                    }
                                    value *= extvalue;
                                });
                                value *= extvalue - 0.5;
                                break;
                        }
                        pairsList.push([player.storage['DALF_Zafkiel'].indexOf(i) + 1, value])
                    }
                    pairsList.randomSort();
                    pairsList.sort((a, b) => a[1] - b[1]);
                    return pairsList[0][0];
                },
                backup(result, player) {
                    let content;
                    if (result.control == '选项一')
                        content = lib.skill['DALF_Zafkiel'].contentx;
                    else if (result.control.indexOf('DALF_Zafkiel') == 0)
                        content = lib.skill[result.control].contentx;
                    else
                        content = () => { };
                    return {
                        audio: "DALF_sizhou",
                        popup: false,
                        direct: true,
                        filterCard: () => false,
                        selectCard: -1,
                        precontent() {
                            player.logSkill('DALF_sizhou');
                            const count = player.getHistory(
                                'useSkill',
                                evt => evt.skill == 'DALF_sizhou'
                            ).length - 1;
                            if (count) player.removeMark('DALF_shicheng', count);
                        },
                        content: content
                    }
                }
            },
            ai: {
                order: 10,
                result: {
                    player(player, target) {
                        return player.getHistory(
                            'useSkill',
                            evt => evt.skill == 'DALF_sizhou'
                        ).length < 3 ? 1 : 0;
                    }
                }
            },
            derivation: [
                "DALF_Zafkiel",
                "DALF_Zafkiel_I",
                "DALF_Zafkiel_II",
                "DALF_Zafkiel_III",
                "DALF_Zafkiel_IV",
                "DALF_Zafkiel_V",
                "DALF_Zafkiel_VI",
                "DALF_Zafkiel_VII",
                "DALF_Zafkiel_VIII",
                "DALF_Zafkiel_IX",
                "DALF_Zafkiel_X",
                "DALF_Zafkiel_XI",
                "DALF_Zafkiel_XII",
                "DALF_Zafkiel_XIII"
            ],
        },
        "DALF_Zafkiel": {
            charlotte: true,
            nobracket: true,
            audio: "ext:约会大作战/audio:true",
            numberValue: {
                "DALF_Zafkiel_I": 1,
                "DALF_Zafkiel_II": 1.5,
                "DALF_Zafkiel_III": 2,
                "DALF_Zafkiel_IV": 0,
                "DALF_Zafkiel_V": 0,
                "DALF_Zafkiel_VI": 0,
                "DALF_Zafkiel_VII": 1.5,
                "DALF_Zafkiel_VIII": 3,
                "DALF_Zafkiel_IX": 1,
                "DALF_Zafkiel_X": 0.5,
                "DALF_Zafkiel_XI": 1,
                "DALF_Zafkiel_XII": 1,
                "DALF_Zafkiel_XIII": 3.5
            },
            async contentx() {
                "step 0"
                player.judge('DALF_sizhou');
                "step 1"
                if (get.color(result.card) == 'black')
                    player.gain(result.card, 'draw2');
                if (typeof result.number == 'number') {
                    player.storage['DALF_Zafkiel'].add(
                        lib.skill.DALF_sizhou.derivation[result.number]
                    );
                    if (result.number == 8) {
                        player.addSkill('DALF_Zafkiel_VIII');
                    }
                    if (result.number < 13)
                        player.markSkill(
                            lib.skill.DALF_sizhou.derivation[result.number]
                        );
                }
                "step 2"
                const storage = player.storage['DALF_Zafkiel'];
                if (storage.length > 3) {
                    let value = 4,
                        controls = [0];
                    for (let i = 0; i < storage.length; i++) {
                        const cv = lib.skill.DALF_Zafkiel.numberValue[storage[i]];
                        if (value > cv) {
                            value = cv;
                            controls = [i];
                        } else if (value == cv) {
                            controls.push(i);
                        }
                    }
                    player.chooseControl(storage)
                        .set('choice', controls.randomGet())
                        .set('prompt', get.translation('DALF_Zafkiel'))
                        .set('prompt2', '请移去一种时弹');
                } else event.finish();
                "step 3"
                player.storage['DALF_Zafkiel'].remove(result.control);
                if (result.control == 'DALF_Zafkiel_VIII')
                    player.removeSkill('DALF_Zafkiel_VIII');
                if (!player.hasSkill(result.control))
                    player.unmarkSkill(result.control);
                else player.markSkill(result.control);

            }
        },
        "DALF_Zafkiel_I": {
            charlotte: true,
            nobracket: true,
            marktext: "Ⅰ",
            intro: {
                content(storage, player) {
                    return (player.hasSkill('DALF_Zafkiel_I') ? '' : '触发此时弹后，') +
                        lib.translate['DALF_Zafkiel_I_info'];
                }
            },
            onremove(player) {
                if (!player.storage['DALF_Zafkiel'].includes('DALF_Zafkiel_I'))
                    player.unmarkSkill('DALF_Zafkiel_I');
                else
                    player.markSkill('DALF_Zafkiel_I');
            },
            trigger: { player: "useCard" },
            forced: true,
            content() {
                "step 0"
                trigger.directHit.addArray(game.filterPlayer());
            },
            contentx() {
                player.addTempSkill('DALF_Zafkiel_I');
            }
        },
        "DALF_Zafkiel_II": {
            charlotte: true,
            nobracket: true,
            marktext: "Ⅱ",
            intro: {
                content(storage, player) {
                    let str = lib.translate['DALF_Zafkiel_II_info'];
                    if (player.hasSkill('DALF_Zafkiel_II'))
                        return str.replace('令一名角色', '你的');
                    return '触发此时弹后，' + str;
                }
            },
            onremove(player) {
                if (!player.storage['DALF_Zafkiel'].includes('DALF_Zafkiel_II'))
                    player.unmarkSkill('DALF_Zafkiel_II');
                else
                    player.markSkill('DALF_Zafkiel_II');
            },
            trigger: { player: "phaseChange" },
            forced: true,
            content() {
                "step 0"
                for (let i = 0; i < trigger.phaseList.length; i++) {
                    if (trigger.phaseList[i] == 'phaseDiscard') {
                        trigger.phaseList.splice(Math.max(0, i - 2), 0, trigger.phaseList.splice(i, 1)[0])
                    }
                }
            },
            contentx() {
                "step 0"
                player.chooseTarget(true)
                    .set('ai', target => {
                        if (get.attitude2(target) > 0)
                            return target.countCards('h') > target.getHandcardLimit() ? 0 : 1.5;
                        return target.countCards('h') - target.getHandcardLimit() - 1;
                    })
                    .set('prompt2', lib.translate['DALF_Zafkiel_II_info'].replace('一名角色', '其'));
                "step 1"
                if (result.bool) {
                    result.targets[0].addTempSkill('DALF_Zafkiel_II');
                    result.targets[0].markSkill('DALF_Zafkiel_II');
                }
            }
        },
        "DALF_Zafkiel_III": {
            charlotte: true,
            nobracket: true,
            marktext: "Ⅲ",
            intro: {
                content(storage, player) {
                    let str = lib.translate['DALF_Zafkiel_III_info'];
                    if (player.hasSkill('DALF_Zafkiel_III'))
                        return str.replace('令一名角色', '你的');
                    return '触发此时弹后，' + str;
                }
            },
            onremove(player) {
                if (!player.storage['DALF_Zafkiel'].includes('DALF_Zafkiel_III'))
                    player.unmarkSkill('DALF_Zafkiel_III');
                else
                    player.markSkill('DALF_Zafkiel_III');
            },
            trigger: { player: "phaseChange" },
            forced: true,
            content() {
                "step 0"
                const len = trigger.phaseList.length;
                for (let i = 0; i < len; i++) {
                    if (trigger.phaseList[i] == 'phaseDraw') {
                        trigger.phaseList.splice(Math.min(len - 1, i + 1), 0, trigger.phaseList.splice(i, 1)[0])
                    }
                }
            },
            contentx() {
                "step 0"
                player.chooseTarget(true)
                    .set('ai', target => {
                        if (get.attitude2(target) > 0) return 0;
                        return 3 - target.countCards('h');
                    })
                    .set('prompt2', lib.translate['DALF_Zafkiel_III_info'].replace('一名角色', '其'));
                "step 1"
                if (result.bool) {
                    result.targets[0].addTempSkill('DALF_Zafkiel_III');
                    result.targets[0].markSkill('DALF_Zafkiel_III');
                }
            }
        },
        "DALF_Zafkiel_IV": {
            charlotte: true,
            nobracket: true,
            marktext: "Ⅳ",
            intro: {
                content(storage, player) {
                    return '触发此时弹后，' +
                        lib.translate['DALF_Zafkiel_IV_info'];
                }
            },
            contentx() {
                "step 0"
                player.chooseTarget(true)
                    .set('filterTarget', lib.filter.notMe)
                    .set('ai', target => {
                        if (get.attitude2(target) > 0) return 3 - target.hp - target.hujia;
                        return target.countCards('h') - 3;
                    })
                    .set('prompt2', lib.translate['DALF_Zafkiel_IV_info'].replace('一名角色', '其'));
                "step 1"
                if (result.bool) {
                    result.targets[0].addTempSkill('diaohulishan', { player: 'phaseBefore' });
                }
            }
        },
        "DALF_Zafkiel_V": {
            charlotte: true,
            marktext: "Ⅴ",
            intro: {
                content(storage, player) {
                    return '触发此时弹后，' +
                        lib.translate['DALF_Zafkiel_V_info'];
                }
            },
            contentx() {
                "step 0"
                const num = player.countMark('DALF_shicheng');
                if (num > 0) player.chooseToGuanxing(num);
            }
        },
        "DALF_Zafkiel_VI": {
            charlotte: true,
            nobracket: true,
            marktext: "Ⅵ",
            intro: {
                mark(dialog, storage, player) {
                    dialog.addText(lib.translate['DALF_Zafkiel_VI_info'] + '<br>');
                    dialog.add('〖' + lib.translate['oldniepan'] + '〗');
                    dialog.addText('<li>' + lib.translate['oldniepan_info'] + '</li>');
                }
            },
            contentx() {
                "step 0"
                player.chooseTarget(true)
                    .set('filterTarget',
                        (card, player, target) => !target.hasSkill('oldniepan')
                    )
                    .set('ai', target => {
                        if (get.attitude2(target) > 0)
                            return 3 - target.countCards('h');
                        return 0;
                    })
                    .set('prompt2', lib.translate['DALF_Zafkiel_VI_info'].replace('一名角色', '其'));
                "step 1"
                if (result.bool) {
                    result.targets[0].addSkillLog('oldniepan');
                    result.targets[0].chooseToDiscard(3, true, 'h');
                }
            }
        },
        "DALF_Zafkiel_VII": {
            charlotte: true,
            nobracket: true,
            marktext: "Ⅶ",
            intro: {
                mark(dialog, storage, player) {
                    dialog.addText(lib.translate['DALF_Zafkiel_VII_info'] + '<br>');
                    dialog.add('〖' + lib.translate['rezhixi'] + '〗');
                    dialog.addText('<li>' + lib.translate['rezhixi_info'] + '</li>');
                }
            },
            contentx() {
                "step 0"
                player.chooseTarget(true)
                    .set('filterTarget',
                        (card, player, target) => !target.hasSkill('rezhixi')
                    )
                    .set('ai', target => {
                        if (get.attitude2(target) > 0) return 0;
                        return target.countCards('h') - 4;
                    })
                    .set('prompt2', lib.translate['DALF_Zafkiel_VII_info'].replace('一名角色', '其'));
                "step 1"
                if (result.bool) {
                    result.targets[0].addTempSkill('rezhixi', { player: 'phaseAfter' });
                }
            }
        },
        "DALF_Zafkiel_VIII": {
            charlotte: true,
            nobracket: true,
            marktext: "Ⅶ",
            intro: {
                mark(dialog, storage, player) {
                    dialog.addText(lib.translate['DALF_Zafkiel_VIII_info'] + '<br>');
                    dialog.add('影子');
                    dialog.add([storage, 'character']);
                },
                markcount(storage, player) {
                    return storage.length;
                }
            },
            init(player, skill) {
                if (!player.storage['DALF_Zafkiel_VIII'])
                    player.storage['DALF_Zafkiel_VIII'] = [];
            },
            trigger: {
                player: ["phaseBegin", "damageBegin4"]
            },
            forced: true,
            filter(event, player) {
                return player.storage['DALF_Zafkiel_VIII'].length > 0;
            },
            content() {
                "step 0"
                if (trigger.name == 'phase') {
                    for (let i = 0; i < player.storage['DALF_Zafkiel_VIII'].length; i++)
                        trigger.phaseList.splice(trigger.num, 0, "phaseUse|DALF_Zafkiel");
                } else {
                    player.storage['DALF_Zafkiel_VIII'].pop();
                    player.markSkill('DALF_Zafkiel_VIII');
                    trigger.cancel();
                }
            },
            contentx() {
                "step 0"
                if (player.storage['DALF_Zafkiel_VIII'].length < 3)
                    player.storage['DALF_Zafkiel_VIII'].push('DALF_TokisakiKurumi');
                player.markSkill('DALF_Zafkiel_VIII');
            }
        },
        "DALF_Zafkiel_IX": {
            charlotte: true,
            nobracket: true,
            marktext: "Ⅸ",
            intro: {
                content(storage, player) {
                    return '触发此时弹后，' +
                        lib.translate['DALF_Zafkiel_IX_info'];
                }
            },
            contentx() {
                "step 0"
                player.chooseTarget(true)
                    .set('ai', target => {
                        if (get.attitude2(target) > 0)
                            return 4 - target.countCards('h');
                        return target.countCards('h') - 4;
                    })
                    .set('prompt2', lib.translate['DALF_Zafkiel_IX_info'].replace('一名角色', '其'));
                "step 1"
                if (result.bool) {
                    event.target = result.targets[0];
                    event.target.gain(target._start_cards || [], 'draw2');
                } else event.finish();
                "step 2"
                const num = event.target.countCards('h') - 4;
                if (num > 0)
                    event.target.chooseToDiscard(true, num, 'h');
            }
        },
        "DALF_Zafkiel_X": {
            charlotte: true,
            nobracket: true,
            marktext: "Ⅹ",
            intro: {
                content(storage, player) {
                    return (player.hasSkill('DALF_Zafkiel_X') ? '' : '触发此时弹后，') +
                        lib.translate['DALF_Zafkiel_X_info'];
                }
            },
            onremove(player) {
                if (!player.storage['DALF_Zafkiel'].includes('DALF_Zafkiel_X'))
                    player.unmarkSkill('DALF_Zafkiel_X');
                else
                    player.markSkill('DALF_Zafkiel_X');
            },
            contentx() {
                player.addTempSkill('DALF_Zafkiel_X');
            },
            ai: {
                viewHandcard: true
            }
        },
        "DALF_Zafkiel_XI": {
            charlotte: true,
            nobracket: true,
            marktext: "Ⅺ",
            intro: {
                mark(dialog, storage, player) {
                    if (player.storage['DALF_Zafkiel'].includes('DALF_Zafkiel_XI'))
                        dialog.addText(lib.translate['DALF_Zafkiel_XI_info'] + '<br>');
                    if (storage != undefined)
                        dialog.addText('<b>手牌数：' + storage + '</b>', true);
                }
            },
            contentx() {
                "step 0"
                player.chooseTarget(true)
                    .set('ai', target => {
                        const hs = target.countCards('h'),
                            hp = target.hp;
                        let mhs = target.storage['DALF_Zafkiel_XI'],
                            mhp = target.storage['DALF_Zafkiel_XII'];
                        if (typeof mhs == 'number')
                            mhs -= hs;
                        else mhs = 0;
                        if (typeof mhp == 'number')
                            mhp -= hp;
                        else mhp = 0;
                        if (get.attitude2(target) > 0)
                            return hs - 3 + (mhs + mhp * 1.5);
                        return 3 - hs - (mhs + mhp * 1.5);
                    })
                    .set('prompt2', lib.translate['DALF_Zafkiel_XI_info'].replace('一名角色', '其'));
                "step 1"
                if (result.bool) {
                    const target = result.targets[0];
                    let hs = target.countCards('h'),
                        hp = target.hp;
                    if (typeof target.storage['DALF_Zafkiel_XI'] == 'number') {
                        hs -= target.storage['DALF_Zafkiel_XI'];
                        target.storage['DALF_Zafkiel_XI'] = target.countCards('h');
                        if (hs > 0) {
                            target.chooseToDiscard(hs, 'h', true)
                                .set('prompt', get.translation('DALF_Zafkiel_XI'))
                                .set('prompt2', '弃置' + get.cnNumber(hs) + '张手牌');
                        } else target.draw(-hs);
                    } else {
                        target.storage['DALF_Zafkiel_XI'] = target.countCards('h');
                    }
                    if (typeof target.storage['DALF_Zafkiel_XII'] == 'number') {
                        hp -= target.storage['DALF_Zafkiel_XII'];
                        delete target.storage['DALF_Zafkiel_XII'];
                        if (hp != 0) target.changeHp(-hp);
                    }
                }
            }
        },
        "DALF_Zafkiel_XII": {
            charlotte: true,
            nobracket: true,
            marktext: "Ⅻ",
            intro: {
                mark(dialog, storage, player) {
                    if (player.storage['DALF_Zafkiel'].includes('DALF_Zafkiel_XII'))
                        dialog.addText(lib.translate['DALF_Zafkiel_XII_info'] + '<br>');
                    if (storage != undefined)
                        dialog.addText('<b>体力值：' + storage + '</b>', true);
                }
            },
            contentx() {
                "step 0"
                player.chooseTarget(true)
                    .set('ai', target => {
                        const hs = target.countCards('h'),
                            hp = target.hp;
                        let mhs = target.storage['DALF_Zafkiel_XI'],
                            mhp = target.storage['DALF_Zafkiel_XII'];
                        if (typeof mhs == 'number')
                            mhs -= hs;
                        else mhs = 0;
                        if (typeof mhp == 'number')
                            mhp -= hp;
                        else mhp = 0;
                        if (get.attitude2(target) > 0)
                            return (hp - 1.5) * 2 + (mhs + mhp * 1.5);
                        return (1.5 - hp) * 2 - (mhs + mhp * 1.5);
                    })
                    .set('prompt2', lib.translate['DALF_Zafkiel_XII_info'].replace('一名角色', '其'));
                "step 1"
                if (result.bool) {
                    const target = result.targets[0];
                    let hs = target.countCards('h'),
                        hp = target.hp;
                    if (typeof target.storage['DALF_Zafkiel_XI'] == 'number') {
                        hs -= target.storage['DALF_Zafkiel_XI'];
                        delete target.storage['DALF_Zafkiel_XI'];
                        if (hs > 0) {
                            target.chooseToDiscard(hs, 'h', true)
                                .set('prompt', get.translation('DALF_Zafkiel_XI'))
                                .set('prompt2', '弃置' + get.cnNumber(hs) + '张手牌');
                        } else target.draw(-hs);
                    }
                    if (typeof target.storage['DALF_Zafkiel_XII'] == 'number') {
                        hp -= target.storage['DALF_Zafkiel_XII'];
                        target.storage['DALF_Zafkiel_XII'] = target.hp;
                        if (hp != 0) target.changeHp(-hp);
                    } else {
                        target.storage['DALF_Zafkiel_XII'] = target.hp;
                    }
                }
            }
        },
        "DALF_Zafkiel_XIII": {
            charlotte: true,
            nobracket: true,
            contentx() {
                "step 0"
                event.skills = Object.keys(lib.skill['DALF_Zafkiel'].numberValue)
                for (let i of player.storage['DALF_Zafkiel'])
                    event.skills.remove(i);
                let choiceList = [];
                for (let i of event.skills)
                    choiceList.push(
                        '<b>' + get.translation(i) + '</b>' +
                        '&thinsp;' + get.translation(i + '_info')
                    );
                player.chooseControl(event.skills)
                    .set('choiceList', choiceList)
                    .set('displayIndex', false)
                    .set('ai', function () {
                        let choice = 0,
                            value = 0;
                        for (let i = 0; i < event.skills.length; i++) {
                            const cv = lib.skill['DALF_Zafkiel'].numberValue[event.skills[i]];
                            if (cv > value) {
                                value = cv;
                                choice = i;
                            } else if (cv == value && Math.random() > 0.3) {
                                choice = i;
                            }
                        }
                        return choice;
                    })
                    .set('prompt', '刻刻帝：选择一种时弹');
                "step 1"
                const skill = event.skills[result.index || 0];
                player.storage['DALF_Zafkiel'].remove('DALF_Zafkiel_XIII');
                player.storage['DALF_Zafkiel'].push(skill);
                if (skill == 'DALF_Zafkiel_VIII') {
                    player.addSkill(skill);
                }
                player.markSkill(skill);
            }
        },

        /*氷芽川四糸乃*/
        "DALF_dongjie": {
            audio: "ext:约会大作战/audio:2",
            trigger: {
                global: [
                    "equipEnd",
                    "addJudgeEnd",
                    "gainEnd",
                    "loseEnd",
                    "loseAsyncEnd",
                    "addToExpansionEnd"
                ],
            },
            frequent: true,
            direct: true,
            filter(event, player, onrewrite) {
                return game.hasPlayer(function (current) {
                    const evt = event.getl(current);
                    if (!evt || evt.player != current) return false;
                    if (evt.es && evt.es.length > 0 &&
                        current.countCards('e') == 0) return true;
                    if (evt.js && evt.js.length > 0 &&
                        current.countCards('j') == 0) return true;
                    return false;
                });
            },
            content() {
                "step 0"
                event.players = game.filterPlayer(function (current) {
                    const evt = trigger.getl(current);
                    if (!evt || evt.player != current) return false;
                    if (evt.es && evt.es.length > 0 &&
                        current.countCards('e') == 0) return true;
                    if (evt.js && evt.js.length > 0 &&
                        current.countCards('j') == 0) return true;
                    return false;
                }).sortBySeat(_status.currentPhase);
                "step 1"
                if (event.players.length > 0) {
                    event.current = event.players.shift();
                    const evt = trigger.getl(event.current);
                    let bool = false;
                    if (evt && evt.player == event.current) {
                        if (evt.es && evt.es.length > 0 &&
                            event.current.countCards('e') == 0) bool = true;
                        else if (evt.js && evt.js.length > 0 &&
                            event.current.countCards('j') == 0) bool = true;
                    }
                    if (bool) {
                        player.chooseBool(get.prompt2(event.name)).frequentSkill = event.name;
                    } else event.redo();
                } else event.finish();
                "step 2"
                if (result.bool) {
                    player.logSkill(event.name, event.current);
                    player.draw(2);
                } else event.goto(1);
                "step 3"
                player.chooseCard('h', 2, true)
                    .set('ai', card => 1 / Math.max(1, get.value(card)))
                    .set('prompt', get.translation('DALF_dongjie'))
                    .set('prompt2', '将两张手牌置入' +
                        get.translation(event.current) + '的场上');
                "step 4"
                if (result.bool) {
                    const cards = result.cards.slice(0),
                        slots = [],
                        allslots = [];
                    if (!event.current.hasJudge('DALF_card_dongyu')) {
                        event.current.addJudge({ name: 'DALF_card_dongyu' },
                            cards.splice(0, 1)
                        );
                    }
                    for (let i = 1; i <= 5; i++) {
                        allslots.push('equip' + i);
                        for (let j = event.current.countEmptySlot(i); j > 0; j--) {
                            slots.push('equip' + i);
                            allslots.remove('equip' + i);
                        }
                    }
                    slots
                        .randomSort()
                        .concat(
                            allslots.randomGets(
                                Math.max(0, cards.length - slots.length)
                            )
                        );
                    for (let i = 0; i < cards.length; i++) {
                        const card = get.autoViewAs(cards[i]);
                        card.subtypes = [slots[i]];
                        event.current.equip(card);
                    }
                }
                event.goto(1);
            }
        },
        "DALF_xueyin": {
            audio: "ext:约会大作战/audio:2",
            trigger: {
                player: "damageEnd"
            },
            direct: true,
            filter(event, player) {
                return player.countCards('h') > 0;
            },
            content() {
                "step 0"
                player.chooseToDiscard()
                    .set('ai', function (card) {
                        let count = 0,
                            suit = get.suit(card),
                            type = get.type2(card);
                        game.countPlayer(function (current) {
                            count += current.countDiscardableCards(
                                _status.event.player,
                                'ej',
                                cardx => {
                                    if (get.suit(cardx) != suit)
                                        return false;
                                    if (get.position(cardx) == 'j')
                                        return true;
                                    if (get.type2(cardx) == 'equip')
                                        return type == 'equip';
                                    return true;
                                }
                            );
                        });
                        return (Math.floor(count / 2) + Math.floor(count / 3)) * 2 - 1;
                    })
                    .set('prompt', get.prompt2('DALF_xueyin'))
                    .set('logSkill', 'DALF_xueyin');
                "step 1"
                if (result.bool) {
                    let count = 0,
                        suit = get.suit(result.cards[0]),
                        type = get.type2(result.cards[0]);
                    game.countPlayer(function (current) {
                        const cards = current.getDiscardableCards(
                            player,
                            'ej',
                            cardx => {
                                if (get.suit(cardx) != suit)
                                    return false;
                                if (get.position(cardx) == 'j')
                                    return true;
                                if (get.type2(cardx) == 'equip')
                                    return type == 'equip';
                                return true;
                            }
                        );
                        count += cards.length;
                        if (cards.length > 0) {
                            current.discard(cards)
                                .set('notBySelf', player != current)
                                .set('discarder', player)
                                .set('delay', false);
                        }
                    });
                    player.draw(Math.floor(count / 2) * 2);
                    player.changeHujia(Math.floor(count / 3));
                }
            }
        },
        "DALF_hanqiao": {
            audio: "ext:约会大作战/audio:2",
            trigger: {
                global: "discardEnd"
            },
            filter(event, player) {
                if (event.discarder) {
                    if (event.discarder != player) return false;
                } else if (event.player != player) return false;
                for (let i of event.cards)
                    if (get.suit(i) == 'diamond')
                        return true;
                return false;
            },
            check(event, player) {
                return get.damageEffect(event.player, player) >= 0;
            },
            content() {
                "step 0"
                trigger.player.damage('ice');
            }
        },

        /*五河琴里*/
        "DALF_chongran": {
            audio: "ext:约会大作战/audio:2",
            mod: {
                aiValue(player, card, num) {
                    if (get.owner(card) == player &&
                        get.position(card) == 'h') {
                        if (get.is.shownCard(card)) {
                            if (get.event().getParent('phaseDiscard')
                                .name == 'phaseDiscard') return num + 5;
                            return num + 1;
                        }
                        return num - 1.5;
                    }
                },
                aiUseful(player, card, num) {
                    if (
                        get.owner(card) == player &&
                        get.position(card) == 'h' &&
                        get.is.shownCard(card) &&
                        get.event().getParent('phaseDiscard')
                            .name == 'phaseDiscard'
                    ) return num + 5;
                }
            },
            trigger: {
                player: ["damageEnd", "loseAfter"],
                global: "loseAsyncAfter"
            },
            forced: true,
            filter(event, player) {
                if (event.name == 'damage') return true;
                if (event.type == 'use') return false;
                const evt = event.getl(player);
                if (!evt || !evt.hs.length) return false;
                return evt.hs.some(cardx => {
                    if (get.position(cardx) != 'd') return false;
                    const tags = event.gaintag_map[cardx.cardid] || [];
                    for (let i = 0; i < tags.length; i++)
                        if (tags[i].startsWith('visible_'))
                            return false;
                    return true;
                });
            },
            async content(event, trigger, player) {
                if (trigger.name == 'damage') {
                    const cards = await player.draw('nodelay', 'visible').forResult();
                    if (cards?.length)
                        player.addShownCards(cards, 'visible_DALF');
                } else {
                    let cards = trigger.getl(player).hs.filter(cardx => {
                        if (get.position(cardx) != 'd') return false;
                        const tags = trigger.gaintag_map[cardx.cardid] || [];
                        for (let i = 0; i < tags.length; i++)
                            if (tags[i].startsWith('visible_'))
                                return false;
                        return true;
                    });
                    if (cards.length) {
                        cards = await player.gain(cards, 'gain2', false).cards;
                        if (cards.length)
                            player.addShownCards(cards, 'visible_DALF');
                    }
                }
            },
            ai: {
                effect: {
                    target(card, source, player) {
                        if (get.tag(card, 'loseCard') && source != player) {
                            if (!player.hasCard(cardx => {
                                return get.is.shownCard(cardx) ||
                                    get.position(cardx) == 'e';
                            }, 'he')) return 0.5;
                        }
                    }
                }
            }
        },
        "DALF_yanxi": {
            audio: "ext:约会大作战/audio:2",
            mod: {
                aiOrder(player, card, num) {
                    if (card?.name == 'jiu') {
                        let num2 = 0;
                        for (const i of lib.inpile) {
                            const cardx = { name: i, cards: 'unsure' };
                            if (get.tag(cardx, 'damage') &&
                                player.hasUsableCard(i, 'limit'))
                                num2 = Math.max(num2, get.order(cardx));
                        }
                        return num - 3.2 + num2;
                    }
                }
            },
            locked: false,
            enable: "chooseToUse",
            filterCard(card) { return get.is.shownCard(card) },
            selectCard: 2,
            viewAs: { name: "jiu", storage: { DALF_yanxi: true } },
            viewAsFilter(player) {
                return player.countCards('h', cardx => {
                    return get.is.shownCard(cardx);
                }) >= 2;
            },
            prompt: "将两张明置牌当【酒】使用，然后摸一张牌",
            check(card) {
                if (_status.event.type == "dying")
                    return 1 / Math.max(0.1, get.value(card));
                return 8 - get.value(card);
            },
            onuse(result, player) {
                player.when('useCardAfter')
                    .filter(event => {
                        return event.skill == 'DALF_yanxi';
                    })
                    .then(() => {
                        player.draw();
                    });
            },
            ai: { threaten: 1.5 },
            group: ["DALF_yanxi_jiuExtra"],
            subSkill: {
                jiuExtra: {
                    audio: "DALF_yanxi",
                    trigger: { player: ["useCard1", "useCardAfter"] },
                    forced: true,
                    firstDo: true,
                    filter(event, player) {
                        if (!player.hasSkill('jiu')) return false;
                        return event.card?.name != 'sha' &&
                            get.tag(event.card, 'damage');
                    },
                    async content(event, trigger, player) {
                        if (event.triggername == 'useCard1') {
                            if (!trigger.baseDamage) trigger.baseDamage = 1;
                            trigger.baseDamage += player.storage.jiu;
                            trigger.jiu = true;
                            trigger.jiu_add = player.storage.jiu;
                            game.log(trigger.card, '受【酒】效果增幅，', '#r伤害值+1');
                        }
                        game.addVideo('jiuNode', player, false);
                        game.broadcastAll(function (player) {
                            player.removeSkill('jiu');
                        }, player);
                    },
                    ai: {
                        damageBonus: true,
                        skillTagFilter(player, tag, arg) {
                            return arg?.card?.name != 'sha' &&
                                get.tag(arg?.card, 'damage');
                        }
                    },
                    sub: true
                }
            }
        },
        "DALF_chizhuo": {
            audio: "ext:约会大作战/audio:2",
            enable: "chooseToUse",
            filterCard: { type: "basic" },
            viewAs: { name: "huogong", storage: { DALF_chizhuo: true } },
            viewAsFilter(player) {
                return player.hasCard({ type: 'basic' }, 'hs');
            },
            prompt: "将一张基本牌当【火攻】使用",
            check(card) { return 6 - get.value(card) },
            ai: {
                player(player, target) {
                    const suits = [];
                    player.countCards('h', cardx => {
                        suits.add(get.suit(cardx));
                    });
                    return suits.length - 3;
                }
            },
            group: ["DALF_chizhuo_trigger"],
            subSkill: {
                trigger: {
                    trigger: { global: "showCardsEnd" },
                    forced: true,
                    filter(event, player) {
                        const evt = event.getParent(1);
                        if (evt.card?.storage?.DALF_chizhuo !== true ||
                            evt.name != 'huogong') return false;
                        return event.cards.some(cardx => {
                            return lib.filter.canBeDiscarded(cardx, player, event.player);
                        });
                        // return event.cards.some(cardx => {
                        //     return !get.is.shownCard(cardx) ||
                        //         player.canRecast(cardx, get.owner(cardx), false);
                        // });
                    },
                    async content(event, trigger, player) {
                        await trigger.player.discard(trigger.cards.filter(cardx => {
                            return lib.filter.canBeDiscarded(cardx, player, trigger.player);
                        }))
                            .set('notBySelf', trigger.player != player)
                            .set('discarder', player);
                    },
                    sub: true
                }
            }
        },

        /*星宫六喰*/
        "DALF_Seguva_mark": {
            audio: "DALF_Seguva",
            charlotte: true,
            removeMark(player, num) {
                player.removeMark('DALF_Seguva_mark', num);
                player.gainMaxHp(num);
                player.recover(num);
                if (!player.hasMark('DALF_Seguva_mark')) {
                    player.removeSkill('DALF_Seguva_mark');
                }
            },
            mark: true,
            marktext: "锁",
            intro: {
                name: "锁(闭/解/开/放)",
                name2: "锁",
                content: "mark",
            },
            trigger: {
                player: "phaseJieshu"
            },
            forced: true,
            unique: true,
            filter(event, player) {
                return player.maxHp > 1;
            },
            content() {
                "step 0"
                player.loseMaxHp(1);
                player.addMark('DALF_Seguva_mark', 1);
            },
            ai: {
                effect: {
                    target(card, player, target, current) {
                        if (player.hasMark('DALF_Rataibu_mark')) {
                            if (get.tag(card, 'damage')) {
                                if (game.players.length == 2) return [1, 0];
                                return [1, 2];
                            }
                        }
                    }
                }
            }
        },
        "DALF_Rataibu_mark": {
            audio: "DALF_Rataibu",
            charlotte: true,
            mark: true,
            marktext: "钥",
            intro: {
                name: "钥(开/放)",
                name2: "钥",
                content: "摸牌阶段，你多摸两张牌；你的手牌上限-2"
            },
            mod: {
                maxHandcard(player, num) {
                    return num - 2;
                }
            },
            trigger: {
                player: "phaseDrawBegin2",
                source: "damageAfter",
            },
            forced: true,
            filter(event, player, onrewrite) {
                if (onrewrite == 'phaseDrawBegin2') return true;
                return !event.numFixed && event.player.hasMark('DALF_Seguva_mark');
            },
            content() {
                "step 0"
                if (event.triggername == 'phaseDrawBegin2') {
                    trigger.num += 2;
                } else {
                    lib.skill['DALF_Seguva_mark'].removeMark(trigger.player, 1);
                    player.gainMaxHp(1);
                }
            },
            sub: true
        },
        "DALF_Seguva": {
            audio: "ext:约会大作战/audio:1",
            enable: "phaseUse",
            filter(event, player) {
                return (player.getStat().skill['DALF_Seguva'] || 0) + 1 < player.countCards('he');
            },
            filterCard: true,
            selectCard() {
                return (_status.event.player.getStat().skill['DALF_Seguva'] || 0) + 2;
            },
            position: "he",
            filterTarget(card, player, target) {
                return player != target && (!target.hasMark('DALF_Seguva_mark') || target.maxHp > 1);
            },
            check(card) {
                return 7 - get.value(card);
            },
            content() {
                "step 0"
                target.addSkill('DALF_Seguva_mark');
                target.loseMaxHp(1);
                target.addMark('DALF_Seguva_mark', 1);
            },
            ai: {
                order(name, player) {
                    if (player.getStat().skill['DALF_Seguva']) return 1;
                    return 10;
                },
                threaten: 1.7,
                result: {
                    target(player, target) {
                        if (target.maxHp == 1) return -10;
                        if (game.countPlayer() == 2) return -4;
                        if (target.isHealthy() && get.damageEffect(target, player, player) >= 0) {
                            return -1.5;
                        }
                        return target.getDamagedHp() - 0.5;
                    },
                    player(player, target) {
                        if ((player.getStat().skill['DALF_Seguva'] || 0) <= player.needsToDiscard()) return 0.4;
                        return -0.5;
                    }
                }
            }
        },
        "DALF_Shifururu": {
            audio: "ext:约会大作战/audio:2",
            ai: {
                threaten: 1.3,
            },
            group: ["DALF_Shifururu_tianxiang", "DALF_Shifururu_skipState"],
            subSkill: {
                tianxiang: {
                    audio: "DALF_Shifururu",
                    charlotte: true,
                    trigger: {
                        player: "damageBegin3"
                    },
                    direct: true,
                    filter(event, player) {
                        return game.hasPlayer(function (current) {
                            return current.hasMark('DALF_Seguva_mark');
                        });
                    },
                    content() {
                        "step 0"
                        var next = player.chooseTarget();
                        next.filterTarget = function (card, player, target) {
                            return target.hasMark('DALF_Seguva_mark');
                        };
                        next.ai = function (target) {
                            return 1;
                        };
                        next.set('prompt', get.prompt('DALF_Shifururu'));
                        next.set('prompt2', '当你受到伤害时，你可以移去其他角色一枚“锁”并摸一张牌，将此伤害转移给其。');
                        "step 1"
                        if (result.bool) {
                            player.logSkill(event.name, result.targets);
                            lib.skill['DALF_Seguva_mark'].removeMark(result.targets[0], 1);
                            player.draw();
                            trigger.player = result.targets[0];
                        }
                    },
                    sub: true
                },
                skipState: {
                    audio: "DALF_Shifururu",
                    charlotte: true,
                    trigger: {
                        global: ["phaseDrawBefore", "phaseDiscardBefore"],
                    },
                    filter(event, player, onrewrite) {
                        return event.player.countMark('DALF_Seguva_mark') >= 2;
                    },
                    check(event, player) {
                        if (get.attitude(player, event.player) > 0) {
                            if (!event.player.needsToDiscard()) return false;
                            return event.name == 'phaseDiscard';
                        }
                        return event.player.countCards('h') < 3 &&
                            event.name == 'phaseDraw';
                    },
                    prompt2: "有“锁”的角色摸牌阶段或弃牌阶段开始前，你可以移去其两枚“锁”令其跳过之。",
                    content() {
                        "step 0"
                        lib.skill['DALF_Seguva_mark'].removeMark(trigger.player, 2);
                        trigger.cancel();
                    },
                    sub: true
                }
            }
        },
        "DALF_Rataibu": {
            audio: "ext:约会大作战/audio:1",
            trigger: {
                global: "phaseBefore",
                player: ["enterGame", "phaseJieshu"]
            },
            forced: true,
            filter(event, player, onrewrite) {
                if (onrewrite == 'phaseJieshu') return game.hasPlayer(function (current) {
                    return current.hasMark('DALF_Rataibu_mark');
                });
                if (onrewrite == 'phaseBefore') return game.phaseNumber == 0;
                return true;
            },
            async content(event, trigger, player) {
                if (event.triggername == 'phaseJieshu') {
                    const result = await player.chooseTarget(true, 2)
                        .set('filterTarget', (card, player, target) => {
                            console.log(ui.selected.targets);
                            if (ui.selected.targets.length == 0)
                                return target.hasMark('DALF_Rataibu_mark');
                            return true;
                        })
                        .set('ai', (target) => {
                            return _status.event.player.attitudeTo(target);
                        })
                        .set('prompt', '开：请移动“钥”标记')
                        .forResult();
                    if (result.bool) {
                        result.targets[0].removeMark('DALF_Rataibu_mark', 1, false);
                        result.targets[0].line(result.targets[1], 'green');
                        result.targets[1].addMark('DALF_Rataibu_mark', 1);
                        game.countPlayer(function (current) {
                            if (current.hasMark('DALF_Rataibu_mark'))
                                current.addSkill('DALF_Rataibu_mark');
                            else
                                current.removeSkill('DALF_Rataibu_mark');
                        });
                    }
                } else {
                    player.addMark('DALF_Rataibu_mark', 1);
                    player.addSkill('DALF_Rataibu_mark');
                }
            }
        },
        "DALF_Heresu": {
            audio: "ext:约会大作战/audio:true",
            mark: true,
            marktext: "放",
            intro: {
                content: "limited",
            },
            skillAnimation: true,
            animationColor: "golden",
            init(player, skill) {
                if (!player.storage[skill]) {
                    player.storage[skill] = false;
                }
            },
            trigger: {
                global: "phaseUseBegin"
            },
            limited: true,
            unique: true,
            filter(event, player) {
                return event.player.hasMark('DALF_Seguva_mark') && event.player.hasMark('DALF_Rataibu_mark');
            },
            check(event, player) {
                if (player.attitudeTo(event.player) <= 0) return false;
                if (event.player.countMark('DALF_Seguva_mark') > 2 &&
                    event.player.countCards('hs', { name: 'sha' }) > 2) return true;
                return false;
            },
            content() {
                "step 0"
                player.awakenSkill('DALF_Heresu');
                "step 1"
                const num = trigger.player.countMark('DALF_Seguva_mark');
                if (num) {
                    lib.skill['DALF_Seguva_mark'].removeMark(trigger.player, num);
                    trigger.player.draw(num);
                    trigger.player.storage['DALF_Heresu_moreUseSha'] = num;
                    trigger.player.addTempSkill('DALF_Heresu_moreUseSha', 'phaseUseEnd');
                }
                trigger.player.addTempSkill('DALF_Heresu_end', 'phaseUseAfter');
            },
            ai: {

            },
            subSkill: {
                moreUseSha: {
                    charlotte: true,
                    mod: {
                        cardUsable(card, player, num) {
                            if (card.name == 'sha') return num + player.storage['DALF_Heresu_moreUseSha'] || 0;
                        }
                    },
                    onremove(player) {
                        delete player.storage['DALF_Heresu_moreUseSha'];
                    },
                    sub: true
                },
                end: {
                    charlotte: true,
                    mark: true,
                    marktext: "放",
                    intro: {
                        name: "放",
                        content: "你还没有造成击杀，本阶段结束时你将移去“钥”标记"
                    },
                    trigger: {
                        source: "dieAfter",
                        player: "phaseUseEnd"
                    },
                    direct: true,
                    content() {
                        "step 0"
                        if (event.triggername == 'phaseUseEnd') {
                            player.removeMark('DALF_Rataibu_mark');
                        } else {
                            player.removeSkill('DALF_Heresu_end');
                        }
                    },
                    sub: true
                }
            }
        },

        /*七罪*/
        "DALF_yanzuo": {
            audio: "ext:约会大作战/audio:2",
            enable: "phaseUse",
            usable: 1,
            filter(event, player) {
                return player.countCards('he');
            },
            filterCard: true,
            position: "h",
            check(card) {
                return 7 - get.value(card);
            },
            filterTarget(card, player, target) {
                if (target == player) return false;
                return lib.skill['DALF_yanzuo'].getSkills(target, true).length > 0;
            },
            content() {
                "step 0"
                event.skills = lib.skill['DALF_yanzuo'].getSkills(target, true);
                let choiceList = [];
                for (let i of event.skills) {
                    choiceList.push(
                        '<b>' + get.translation(i) + '</b>' +
                        '&thinsp;' + get.translation(i + '_info')
                    );
                }
                var next = player.chooseControl(event.skills);
                next.set('choiceList', choiceList);
                next.set('displayIndex', false);
                next.set('ai', function () {
                    for (let i of event.skills) {
                        if (player.hasSkill(i)) continue;
                        let info = lib.skill[i];
                        if (info.enable && info.usable !== 1) return i;
                    }
                    return event.skills.filter(function (i) {
                        return !player.hasSkill(i);
                    }).randomGet() || event.skills[0];
                });
                next.set('prompt', '赝作：选择一个技能获得');
                "step 1"
                player.addSkillLog(event.skills[result.index || 0]);
            },
            ai: {
                threaten: 1.3,
                order: 10,
                result: {
                    target(player, target) {
                        let list = lib.skill['DALF_yanzuo'].getSkills(target, true);
                        for (let i = 0; i < list.length; i++)
                            if (player.hasSkill(list[i]))
                                list.splice(i--, 1);
                        if (!list.length) return 0;
                        if (get.attitude(player, target) <= 0) return -10 / list.length;
                        return 10 / list.length;
                    }
                }
            },
            group: ["DALF_yanzuo_loseSkill"],
            subSkill: {
                loseSkill: {
                    audio: "DALF_yanzuo",
                    trigger: { player: "damageEnd" },
                    forced: true,
                    filter(event, player) {
                        return lib.skill['DALF_yanzuo'].getSkills(player).length > player.maxHp;
                    },
                    content() {
                        "step 0"
                        event.skills = lib.skill['DALF_yanzuo'].getSkills(player);
                        skills2 = lib.skill['DALF_yanzuo'].getSkills(player, true);
                        let choiceList = [];
                        for (let i of event.skills) {
                            choiceList.push(
                                '<b>' + get.translation(i) + '</b>' +
                                '&thinsp;' + get.translation(i + '_info')
                            );
                        }
                        var next = player.chooseControl(event.skills);
                        next.set('choiceList', choiceList);
                        let choice = event.skills.indexOf(skills2.randomGet());
                        if (choice == -1) choice = event.skills[event.skills.length - 1];
                        next.set('choice', choice);
                        next.set('prompt', '赝作：选择一个技能失去');
                        "step 1"
                        let skill = event.skills[result.index || 0];
                        player.removeSkill(skill);
                        game.log(player, '失去了技能', '#g【' + get.translation(skill) + '】');
                    },
                    sub: true
                }
            },
            getSkills(player, noforced) {
                let skills = player.getSkills(true, false, false);
                for (let i = 0; i < skills.length; i++) {
                    let info = lib.skill[skills[i]];
                    if (!info || info.charlotte || info.sub)
                        skills.splice(i--, 1);
                }
                if (noforced) {
                    for (let i = 0; i < skills.length; i++) {
                        let translation = lib.translate[skills[i] + '_info'] || '';
                        if (!translation.length || translation.indexOf('锁定技') != -1)
                            skills.splice(i--, 1);
                    }
                }
                return skills;
            }
        },
        "DALF_jingxiang": {
            audio: "ext:约会大作战/audio:1",
            mod: {
                ignoredHandcard(card, player) {
                    if (get.itemtype(card) == 'card' &&
                        card.hasGaintag('DALF_jingxiang'))
                        return true;
                },
                cardDiscardable(card, player, name) {
                    if (name == 'phaseDiscard' &&
                        (get.itemtype(card) == 'card' &&
                            card.hasGaintag('DALF_jingxiang')))
                        return false;
                }
            },
            trigger: {
                player: "loseEnd",
                target: "useCardToEnd",
                global: "useCardEnd"
            },
            usable: 7,
            forced: true,
            filter(event, player, onrewrite) {
                if (event.name == 'lose') {
                    if (event.gaintag_map)
                        for (let i in event.gaintag_map)
                            if (event.gaintag_map[i].includes('DALF_jingxiang'))
                                return true;
                    return false;
                }
                if (event.player == player)
                    return false;
                if (!event.card.isCard || !event.cards || event.cards.length != 1)
                    return false;
                if (event.name != 'useCard')
                    return true;
                return event.respondTo && event.respondTo[0] == player;
            },
            content() {
                "step 0"
                if (event.triggername.indexOf('useCard') != -1) {
                    let cardx = game.createCard(trigger.card);
                    if (cardx) {
                        var next = player.gain(cardx, 'gain2', 'log');
                        next.gaintag.add('DALF_jingxiang');
                    }
                    event.finish();
                } else if (trigger.type == 'use') {
                    var next = player.chooseToDiscard('h', true);
                    next.set('prompt', '镜像');
                    next.set('prompt2', '当你因使用或打出而失去「镜像」牌时，弃置一张手牌');
                } else {
                    player.actionHistory[player.actionHistory.length - 1].useCard = [];
                    let history = game.getGlobalHistory('useCard');
                    for (let i = 0; i < history.length; i++)
                        if (history[i].player == player)
                            history.splice(i--, 1);
                    player.stat[player.stat.length - 1].card = {};
                }
            },
            group: ["DALF_jingxiang_count"],
            subSkill: {
                count: {
                    charlotte: true,
                    marktext: "镜",
                    intro: {
                        name: "镜像",
                        content: "已发动&次"
                    },
                    trigger: {
                        global: ["phaseBefore", "DALF_jingxiangAfter"]
                    },
                    direct: true,
                    content() {
                        "step 0"
                        if (trigger.name == 'phase') player.setMark('DALF_jingxiang_count', 0, false);
                        else player.addMark('DALF_jingxiang_count', 1, false);
                    },
                    sub: true
                }
            }
        },

        /*八舞姐妹*/
        "DALF_jufeng": {
            audio: "ext:约会大作战/audio:2",
            trigger: {
                player: "useCardToPlayered"
            },
            direct: true,
            filter(event, player) {
                if (event.card.name != 'sha') return false;
                if (event.target.isLinked()) return false;
                for (let i of 'hej') {
                    if (event.target.countCards(i) > 0 && !event.target.hasCard(function (card) {
                        return !event.target.canRecast(card);
                    })) return true;
                }
                return false;
            },
            content() {
                "step 0"
                let list = [];
                for (let i of 'hej') {
                    if (trigger.target.countCards(i) > 0 && !trigger.target.hasCard(function (card) {
                        return !trigger.target.canRecast(card);
                    })) list.push({ 'h': '手牌区', 'e': '装备区', 'j': '判定区' }[i]);
                }
                let next = player.chooseControl(list.concat(['cancel2']));
                next.set('prompt', get.prompt2('DALF_jufeng', trigger.target));
                if (list.includes('判定区')) {
                    if (list.length == 1) next.set('choice', 1);
                    else next.set('choice', 0);
                } else next.set('choice', list.length - 1);
                "step 1"
                if (result.control != 'cancel2') {
                    player.logSkill('DALF_jufeng', trigger.target);
                    trigger.target.link(true);
                    let pos = { '手牌区': 'h', '装备区': 'e', '判定区': 'j' }[result.control];
                    let cards = trigger.target.getCards(pos);
                    trigger.target.recast(cards);
                    trigger.target.addTempSkill('DALF_jufeng_2');
                    if (pos != 'h') event.finish();
                } else event.finish();
                "step 2"
                if (result && result.recastingLose) {
                    for (let c of result.recastingLose) {
                        trigger.target.storage['DALF_jufeng_2'].add(get.suit(c));
                    }
                }
            },
            subSkill: {
                "2": {
                    mod: {
                        cardEnabled2(card, player) {
                            if (get.position(card) == 'h' && player.storage['DALF_jufeng_2'].includes(get.suit(card))) return false;
                        }
                    },
                    init(player, skill) {
                        if (!player.storage[skill]) player.storage[skill] = [];
                    },
                    onremove: true,
                    sub: true
                }
            }
        },
        "DALF_jichi": {
            audio: "ext:约会大作战/audio:2",
            init(player, skill) {
                if (!player.storage['DALF_xieliao_ai'])
                    player.storage['DALF_xieliao_ai'] = [];
            },
            marktext: "驰",
            intro: {
                name: "疾驰",
                content: "本回合已有&张牌进入弃牌堆"
            },
            mod: {
                targetInRange(card, player, target, now) {
                    return true;
                },
                cardUsable(card, player, num) {
                    return Infinity;
                }
            },
            trigger: {
                global: ["phaseBefore", "loseAfter", "cardsDiscardAfter", "loseAsyncAfter", "equipAfter"]
            },
            usable: 1,
            forced: true,
            filter(event, player) {
                if (event.name == 'phase') {
                    delete player.storage['DALF_jichi'];
                    player.unmarkSkill('DALF_jichi');
                    return false;
                }
                let num = 0;
                game.getGlobalHistory('cardMove', function (evt) {
                    if (evt.name == 'cardsDiscard' || (evt.name == 'lose' && evt.position == ui.discardPile)) num += evt.cards.length;
                });
                if (num > 0 && num < 8) {
                    player.storage['DALF_jichi'] = num;
                    player.markSkill('DALF_jichi');
                } else {
                    delete player.storage['DALF_jichi'];
                    player.unmarkSkill('DALF_jichi');
                }
                return num >= 8;
            },
            content() {
                "step 0"
                player.turnOver();
                let phasestage = event.getParent(function (evt) {
                    return evt.name.indexOf('phase') == 0 && evt.name.length > 5;
                }, true);
                if (phasestage != null) {
                    phasestage.finish();
                    let phaseevent = event.getParent(function (evt) {
                        return evt.name == 'phase';
                    }, true);
                    if (phaseevent != null) {
                        phaseevent.finish();
                    }
                }
            },
            derivation: ["DALF_xieliao", "DALF_tianji"]
        },
        "DALF_xieliao": {
            audio: "ext:约会大作战/audio:2",
            enable: "chooseToUse",
            filter(event, player) {
                return event.respondTo && event.respondTo[0] != player &&
                    event.respondTo[0].isLinked() && (
                        event.filterCard({ name: 'shan', isCard: true }, player, event) ||
                        event.filterCard({ name: 'wuxie', isCard: true }, player, event)
                    );
            },
            chooseButton: {
                dialog(event, player) {
                    var list = [];
                    if (event.filterCard({ name: 'shan', isCard: true }, player, event))
                        list.push(['basic', '', 'shan']);
                    if (event.filterCard({ name: 'wuxie', isCard: true }, player, event))
                        list.push(['trick', '', 'wuxie']);
                    return ui.create.dialog('解镣', [list, 'vcard']);
                },
                check(button) {
                    return _status.event.player.getUseValue({
                        name: button.link[2],
                        isCard: true
                    });
                },
                backup(links, player) {
                    return {
                        audio: 'DALF_xieliao',
                        popname: true,
                        filterCard: () => false,
                        selectCard: -1,
                        viewAs: { name: links[0][2] }
                    }
                }
            },
            hiddenCard(player, name) {
                if (!['shan', 'wuxie'].includes(name)) return false;
                return player.storage['DALF_xieliao_ai'].length > 0;
            },
            ai: {
                respondShan: true,
                skillTagFilter(player, tag, arg) {
                    if (tag == 'respondShan') {
                        if (arg != 'use' || player.storage['DALF_xieliao_ai'].length == 0) return false;
                    }
                },
                order: 7,
                result: { player: 1 }
            },
            group: ['DALF_xieliao_unlink', 'DALF_xieliao_ai'],
            subSkill: {
                unlink: {
                    trigger: { player: 'useCardBegin' },
                    direct: true,
                    filter(event) {
                        return event.skill == 'DALF_xieliao_backup' && event.respondTo &&
                            get.itemtype(event.respondTo[0]) == 'player';
                    },
                    content() {
                        "step 0"
                        trigger.respondTo[0].link(false);
                    },
                    sub: true
                },
                ai: {
                    trigger: { player: ['chooseToUseBefore', 'chooseToUseAfter'] },
                    direct: true,
                    content() {
                        "step 0"
                        if (player.storage['DALF_xieliao_ai'].includes(trigger)) {
                            player.storage['DALF_xieliao_ai'].remove(trigger);
                        } else if (trigger.respondTo && trigger.respondTo[0].isLinked()) {
                            player.storage['DALF_xieliao_ai'].push(trigger);
                        }
                    },
                    sub: true
                }
            }
        },
        "DALF_tianji": {
            audio: "ext:约会大作战/audio:2",
            trigger: {
                player: ["useCardEnd", "respondEnd"]
            },
            forced: true,
            filter(event, player) {
                return Array.isArray(event.respondTo) && event.respondTo[0] != player;
            },
            content() {
                "step 0"
                player.draw(3);
                "step 1"
                _status.globalHistory[_status.globalHistory.length - 1]['cardMove'].length = 0;
                game.countPlayer(function (current) {
                    current.actionHistory[current.actionHistory.length - 1]['gain'].length = 0;
                    current.actionHistory[current.actionHistory.length - 1]['lose'].length = 0;
                });
                "step 2"
                player.turnOver();
            },
            derivation: ["DALF_jufeng", "DALF_jichi"]
        },

        /*诱宵美九*/
        "DALF_hexian": {
            audio: "ext:约会大作战/audio:2",
            trigger: {
                player: "useCardEnd"
            },
            direct: true,
            async content(event, trigger, player) {
                const hs = player.countCards('h');
                let players = game.filterPlayer(current => {
                    return current != player &&
                        current.countCards('h') == hs;
                }).sortBySeat(_status.currentPhase);
                const typex = get.type2(trigger.card);
                while (players.length > 0) {
                    let current = players.shift();
                    const result = await current.chooseToUse({
                        typex: typex,
                        filterCard(card, player) {
                            if (get.type2(card) != _status.event.typex) return false;
                            return lib.filter.filterCard.apply(this, arguments);
                        },
                        ai1(card) {
                            const evt = _status.event.respondTo;
                            if (get.attitude2(evt[0]) > 0) return get.cacheOrder(card);
                            if (get.number(_status.event.respondTo[1]) > get.number(card)) return 0;
                            return get.cacheOrder(card);
                        },
                        addCount: false,
                        respondTo: [player, trigger.card],
                        prompt: '是否响应' + get.translation(player) + '的【和弦】？',
                        prompt2: '以响应' + get.translation(player) + '使用的' +
                            get.translation(trigger.card) + '的形式，使用一张' + get.translation(typex) + '牌',
                        logSkill: ['DALF_hexian', player]
                    }).forResult();
                    if (result.bool) break;
                }
            }
        },
        "DALF_xiezou": {
            audio: "ext:约会大作战/audio:2",
            trigger: {
                global: ["useCard", "respond"]
            },
            forced: true,
            filter(event, player) {
                if (!event.respondTo) return false;
                if (!get.number(event.card) || !get.number(event.respondTo[1])) return false;
                return event.player == player || event.respondTo[0] == player;
            },
            async content(event, trigger, player) {
                "step 0"
                let numberP, numberT, target;
                if (trigger.player == player) {
                    numberP = get.number(trigger.card);
                    numberT = get.number(trigger.respondTo[1]);
                    target = trigger.respondTo[0];
                } else {
                    numberP = get.number(trigger.respondTo[1]);
                    numberT = get.number(trigger.card);
                    target = trigger.player;
                }
                if (numberP > numberT) await player.draw(1);
                else if (numberP < numberT) await target.draw(1);
            },
        },
        "DALF_shengmu": {
            audio: "ext:约会大作战/audio:1",
            marktext: "🎤",
            intro: {
                content: "limited"
            },
            init(player, skill) {
                if (!player.storage[skill]) player.storage[skill] = false;
            },
            onremove(player) {
                delete player.storage['DALF_shengmu_count'];
                player.unmarkSkill('DALF_shengmu_count');
            },
            trigger: {
                player: "phaseJieshuBegin"
            },
            forced: true,
            juexingji: true,
            skillAnimation: true,
            animationColor: "wood",
            filter(event, player) {
                let numbers = [];
                game.getGlobalHistory('cardMove', function (evt) {
                    if (evt.cards && evt.cards.length)
                        for (let i of evt.cards)
                            if (get.position(i) == 'd' && typeof i.number == 'number' &&
                                i.number >= 1 && i.number <= 13) numbers.add(i.number);
                });
                return numbers.length >= 9;
            },
            content() {
                "step 0"
                player.awakenSkill('DALF_shengmu');
                player.unmarkSkill('DALF_shengmu_count');
                player.markSkill('DALF_shengmu');
                player.addSkillLog('DALF_anke');
                player.gainMaxHp(1);
            },
            group: ["DALF_shengmu_count"],
            derivation: ["DALF_anke"],
            subSkill: {
                count: {
                    charlotte: true,
                    marktext: "🎤",
                    intro: {
                        content: "本回合已在弃牌堆的点数：<br>\$"
                    },
                    trigger: {
                        player: "phaseAfter",
                        global: ["loseAfter", "cardsDiscardAfter", "loseAsyncAfter", "equipAfter"]
                    },
                    silent: true,
                    priority: 2,
                    filter(event, player) {
                        if (event.name == 'phase') {
                            delete player.storage['DALF_shengmu_count'];
                            player.unmarkSkill('DALF_shengmu_count');
                        } else if (!player.storage['DALF_shengmu'] && _status.currentPhase == player) {
                            let numbers = [];
                            game.getGlobalHistory('cardMove', function (evt) {
                                if (evt.cards && evt.cards.length)
                                    for (let i of evt.cards)
                                        if (get.position(i) == 'd' && typeof i.number == 'number' &&
                                            i.number >= 1 && i.number <= 13) numbers.add(i.number);
                            });
                            if (numbers.length > 0) {
                                numbers.sort((a, b) => b - a);
                                for (let i = 0; i < numbers.length; i++) {
                                    switch (numbers[i]) {
                                        case 1:
                                            numbers[i] = 'A';
                                            break;
                                        case 11:
                                            numbers[i] = 'J';
                                            break;
                                        case 12:
                                            numbers[i] = 'Q';
                                            break;
                                        case 13:
                                            numbers[i] = 'K';
                                            break;
                                    }
                                }
                                player.storage['DALF_shengmu_count'] = numbers;
                                player.markSkill('DALF_shengmu_count');
                            }
                        }
                        return false;
                    },
                    content() { },
                    sub: true
                }
            }
        },
        "DALF_anke": {
            audio: "ext:约会大作战/audio:2",
            trigger: {
                global: "phaseJieshu"
            },
            direct: true,
            filter(event, player) {
                return game.hasPlayer(function (current) {
                    if (current == player || !current.hasSex('female')) return false;
                    return current.hasHistory('useCard', function (evt) {
                        return evt.respondTo && evt.respondTo[0] == player;
                    });
                });
            },
            async content(event, trigger, player) {
                const result = player.chooseTarget()
                    .set('filterTarget', function (card, player, target) {
                        if (player == target || !target.hasSex('female')) return false;
                        return target.hasHistory('useCard', function (evt) {
                            return evt.respondTo && evt.respondTo[0] == player;
                        });
                    })
                    .set('ai', function (target) {
                        if (get.attitude2(target) <= 0) {
                            if (target.isDamaged()) return 0;
                            return 2 - target.countCards('hs');
                        }
                        return Math.max(target.countCards('hs'), target.isTurnedOver() ? 5 : 0);
                    })
                    .set('prompt2', get.prompt(event.name))
                    .forResult();
                if (result.bool) {
                    let target = result.targets[0];
                    player.logSkill('DALF_anke', target);
                    player.recover();
                    target.recover();
                    let players = [player, target].sortBySeat(_status.currentPhase);
                    for (let i of players) {
                        i.insertPhase('DALF_anke').phaseList = ['phaseUse'];
                    }
                }
            }
        },

        /*夜刀神十香*/
        "DALF_zhongjian": {
            audio: "ext:约会大作战/audio:1",
            shaRelated: true,
            enable: "chooseToUse",
            filter(event, player) {
                if (!player.countCards('h')) return false;
                return true;
            },
            filterCard(card) {
                if (ui.selected.cards.length > 0)
                    return get.is.shownCard(card) ==
                        get.is.shownCard(ui.selected.cards[0]);
                return true;
            },
            selectCard() {
                if (ui.selected.cards.length > 0)
                    return -1;
                return [1, Infinity];
            },
            complexCard: true,
            position: "h",
            viewAs: {
                name: "sha",
            },
            viewAsFilter(player) {
                if (!player.countCards('h')) return false;
            },
            prompt: "将所有手牌当【杀】使用",
            check(card) {
                return 6.4 - get.value(card);
            },
            ai: {
                order(item, player) {
                    if (player.countCards('h') > 3) return 3;
                    return Math.ceil(get.order({ name: 'sha' }));
                },
                respondSha: true,
                skillTagFilter(player, tag) {
                    if (tag == 'respondSha') {
                        if (!player.countCards('h')) return false;
                    }
                },
                result: {
                    player: 1
                }
            },
            group: ["DALF_zhongjian_damage"],
            subSkill: {
                damage: {
                    trigger: {
                        source: "damageBegin1",
                    },
                    forced: true,
                    filter(event, player) {
                        if (event.parent.skill != 'DALF_zhongjian') return false;
                        return event.player.countCards('h') < event.cards.length ||
                            event.player.hp < event.cards.length;
                    },
                    content() {
                        "step 0"
                        let hs = trigger.player.countCards('h'),
                            hp = trigger.player.hp;
                        if (Math.min(hs, hp) < trigger.cards.length) trigger.num++;
                        if ((hs + hp) < trigger.cards.length) trigger.num++;
                    },
                    sub: true
                }
            }
        },
        "DALF_aosha": {
            audio: "ext:约会大作战/audio:1",
            shaRelated: true,
            trigger: {
                player: "phaseJieshu",
            },
            frequent: true,
            async content(event, trigger, player) {
                let countKill = 0;
                if (player.stat && player.stat.length)
                    for (let i = 0; i < player.stat.length; i++)
                        if (player.stat[i].kill != undefined)
                            countKill += player.stat[i].kill;
                const cards = await player.draw(countKill + 1).forResult();
                await player.addShownCards(cards, 'visible_DALF');
                if (countKill > 0) {
                    await player.chooseToUse({
                        filterCard(card, player) {
                            if (get.name(card) != 'sha') return false;
                            return lib.filter.filterCard.apply(this, arguments);
                        },
                        prompt: lib.translate['DALF_aosha'],
                        prompt2: '你可以使用一张【杀】'
                    });
                }
            }
        }
    }
}